<template>
	<view class="content">
		<view class="searchcon">
			<button>搜索</button>
		</view>
		<view class="bannar">
			<!-- 轮播图区域 -->
			<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
				<!-- 循环渲染轮播图的 item 项 -->
				<swiper-item v-for="(item,i) in lunbolist" :key="i">
					<navigator class="swiper-item" :url="'/subpkg/goods_detail/goods_detail?goods_id=' + item.goods_id">
						<!-- 动态绑定图片的 src 属性 -->
						<image style="width:100%;" mode="widthFix" :src="item.image_src" alt=""></image>
					</navigator>
				</swiper-item>
			</swiper>
		</view>
		<view class="navcon">
			<view v-for="item in navlist" style="width: 100%;">
				<img style="width: 100%; height: 100px;" :src="item.image_src" alt="">
			</view>
		</view>
		<view class="floor-list">
			<view style="margin:20px 0" class="floor-item" v-for="(item,i) in floorlist" :key="i">
				<image  style="width:100%;height:30px;" :src="item.floor_title.image_src" class="floor-title"></image>
				<view class="floor-img-box">
					<view class="left-img-box">
						<image :src="item.product_list[0].image_src"
							:style="{width: item.product_list[0].image_width + 'rpx'}" mode="widthFix"></image>
					</view>
					<view class="right-img-box">
							<view class="right-img-item" v-for="(item2, i2) in item.product_list" :key="i2" v-if="i2 != 0">
								<image :src="item2.image_src" mode="widthFix" :style="{width: item2.image_width + 'rpx'}">
								</image>
							</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//轮播图数组
				lunbolist: [],
				//分类数组
				navlist: [],
				//导航数组
				floorlist: [],
			}
		},
		created() {

		},
		onLoad() {
			uni.request({
				url: 'https://www.uinav.com/api/public/v1/home/swiperdata',
				success: (res) => {
					this.lunbolist = res.data.message;
				}
			});
			uni.request({
				url: 'https://www.uinav.com/api/public/v1/home/catitems',
				success: (res) => {
					this.navlist = res.data.message;
				}
			});
			uni.request({
				url: 'https://www.uinav.com/api/public/v1/home/floordata',
				success: (res) => {
					this.floorlist = res.data.message;
				}
			});
		},
		methods: {

		}
	}
</script>

<style>
	
	
	.navcon {
		display: flex;
	}

	.navcon view {
		flex: 1
	}

	.searchcon {
		background: red;
		padding: 5px;
	}

	.searchcon button {
		width: 100%;
		border: none;
		background: #fff;
		height: 70rpx;
	}


	
</style>
